/**
 * <pre>
 * - 计算
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-04-01 9:58
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 **/
public class Calc {

  public static void main(String[] args) {
    Calc c = new Calc();
    int ret = c.add(1,1);
    System.out.println(ret);
    c.add(1,1,1);
    c.add(1,2L);
    c.add(1L,2);
    byte a = 1;
    ret = c.add(a,1);
    System.out.println(ret);
//    c.add(1L,2L);
  }

  public int add(int a,int b){
    System.out.println("int,int");
    return a+b;
  }

  //方法的重载
  //参数的数量不同
  public int add(int a,int b,int c){
    System.out.println("int,int,int");
    return a+b+c;
  }

  //参数的类型不同
  public long add(int a,long b){
    System.out.println("int,long");
    return a+b;
  }
  //参数的类型顺序不同
  public long add(long a,int b){
    System.out.println("long,int");
    return a+b;
  }

  //跟返回类型没有关系
//  public long add(int a,int b){
//    return a+b;
//  }
  //跟参数名称没有关系
//  public long add(long aa,int bb){
//    return a+b;
//  }
  //跟声明抛出的异常无关

}

class Calc1 {
  //不是方法的重载
  public int add(int a,int b,int c,int d){
    return a+b+c;
  }
}

class Calc2 extends  Calc {
  //是方法的重载
  public int add(int a,int b,int c,int d){
    return a+b+c;
  }
}